<template>
	<a-dropdown triger="click" placement="top">
		<a-button>过滤列</a-button>
		<template #overlay>
			<a-menu>
				<template v-for="column in columns">
					<a-menu-item v-if="column.columnType !== 'EMPTYCOLUMN'">
						<a-checkbox
							v-model:checked="column.show"
							@change="handleChange(column, $event)"
							@click.stop
							>{{ column.caption }}</a-checkbox
						>
					</a-menu-item>
				</template>
			</a-menu>
		</template>
	</a-dropdown>
</template>
<script setup lang="ts">
import { IParam } from '@/core';

interface Props {
	columns: IParam[];
}
const props = defineProps<Props>();

const emit = defineEmits<{
	(event: 'column-show-change', codeName: string, checked: boolean): void;
}>();

const handleChange = (column: IParam, event: any) => {
	emit('column-show-change', column.codeName, event.target.checked);
};
</script>
